<div class="hbox hbox-auto-xs hbox-auto-sm" ng-init="
    app.settings.asideFolded = false;
    app.settings.asideDock = false;
  ">
    <!-- main -->
    <div class="col">
        <!-- main header -->
        <div class="bg-light lter b-b wrapper-md">
            <div class="row">
                <div class="col-sm-6 col-xs-12">
                    <h1 class="m-n font-thin h3 text-black">工作流</h1>
                    <small class="text-muted">自动处理日常事务</small>
                </div>
            </div>
        </div>
        <!-- / main header -->
        <div class="wrapper-md" ng-controller="workflowCtrl">
            <!-- toaster directive -->
            <toaster-container
                    toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
            <!-- / toaster directive -->
            <uib-accordion>
                <!--工单列表-->
                <div class="list-group col-md-3">
                    <!--工作流关键字搜索-->
                    <!--<form class="form-inline" role="form">-->
                            <!--<div class="input-group">-->
                                <!--<span class="input-group-addon">topics</span>-->
                                <!--<input type="text" class="form-control" ng-model="queryTopics"-->
                                       <!--placeholder="名称">-->
                            <!--</div>-->
                            <!--<button type="button" class="btn btn-info" ng-click="queryWorkflowGroup()"><span-->
                                    <!--class="glyphicon glyphicon-search"></span>搜索-->
                            <!--</button>-->
                    <!--</form>-->
                    <div class="panel panel-default" ng-repeat="workflowGroup in workflowGroupList">
                        <div uib-accordion-group class="panel-info" is-open="workflowOpen">
                            <uib-accordion-heading>{{workflowGroup.groupName}}
                                <i class="pull-right glyphicon"
                                   ng-class="{'glyphicon-chevron-down': status.open, 'glyphicon-chevron-right': !status.open}"></i>
                            </uib-accordion-heading>
                            <p style="color:#2ea8e5">{{workflowGroup.content}}</p>
                            <div ng-repeat="workflow in workflowGroup.workflowList">
                                <hr/>
                                <p>{{workflow.title}}</p>
                                <a ng-show="workflow.helpLink != ''" href="{{workflow.helpLink}}" style="color: green"
                                   target="_blank"
                                   class="icon icon-question pull-left">使用说明</a>
                                <button ng-if="workflow.wfStatus == 0" ng-click="createTodo(workflow)"
                                        class="btn btn-xs pull-right"
                                        style="background-color: #2e6da4; color: white;">
                                    <i class="fa fa-spin fa-spinner" ng-show="btnCreateTodo"></i>
                                    发起工作流
                                </button>

                                <b ng-if="workflow.todoStatus == 1" class="btn btn-xs pull-right"
                                   style="background-color: #777; color: white;">
                                    维护中
                                </b>

                                <b ng-if="todoItem.todoStatus == 2" class="btn btn-xs pull-right"
                                   style="background-color: #777; color: white;">
                                    开发中
                                </b>
                                </br>
                            </div>
                        </div>
                    </div>
                </div>
            </uib-accordion>

            <uib-tabset class="list-group col-md-9">
                <uib-tab index="0" heading="我的工作流">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <form name="form" class="form-inline">
                                <!--待办工作-->
                                <uib-accordion>
                                    <div class="panel panel-default">
                                        <div uib-accordion-group class="panel-info" is-open="myJobStatusOpen">
                                            <uib-accordion-heading>待办工作流
                                                <i class="pull-right glyphicon"
                                                   ng-class="{'glyphicon-chevron-down': myJobStatusOpen, 'glyphicon-chevron-right': !myJobStatusOpen}"></i>
                                            </uib-accordion-heading>
                                            <div style="margin-top: 5px;">
                                                <table class="table table-striped">
                                                    <thead>
                                                    <tr>
                                                        <td class="col-md-1">类别</td>
                                                        <td class="col-md-5">详情</td>
                                                        <td>状态</td>
                                                        <td>历时</td>
                                                        <td>操作</td>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <tr ng-repeat="todo in myTodoList">
                                                        <td>
                                                            <b style="color: #286090"
                                                               ng-show="todo.workflowDO.wfType == 0">OPS</b>
                                                            <b style="color: #286090"
                                                               ng-show="todo.workflowDO.wfType == 1">OTHER</b>
                                                        </td>
                                                        <td>
                                                            <b style="color: #286090">{{todo.workflowDO.title}}</b>
                                                            <i uib-popover-html="todoDetail.initiatorUserDO.initiatorUserInfo"
                                                               popover-trigger="'mouseenter'"
                                                               class="icon icon-info pull-right"
                                                               style="color: green;"></i>
                                                            <b style="color: #286090" class="pull-right">{{todo.applyDisplayName}}</b>

                                                        </td>
                                                        <td>
                                                            <b style="color: green;"
                                                               ng-show="todo.todoPhase == 0">新建</b>
                                                            <b style="color: #ff8700;"
                                                               ng-show="todo.todoPhase == 1">QA审批</b>
                                                            <b style="color: #ff8700;"
                                                               ng-show="todo.todoPhase == 2">TL审批</b>
                                                            <b style="color: #ff8700;"
                                                               ng-show="todo.todoPhase == 3">DL审批</b>
                                                            <b style="color: #ef2929;"
                                                               ng-show="todo.todoPhase == 4">待审核</b>
                                                            <b style="color: #2e6da4;"
                                                               ng-show="todo.todoPhase == 5">结束</b>
                                                        </td>
                                                        <td>
                                                            <b>{{todo.applyViewTime}}</b>
                                                        </td>
                                                        <td>
                                                            <button class="btn btn-xs"
                                                                    style="margin-right: 5px; background-color: green; color: white;"
                                                                    ng-click="viewTodo(todo)">
                                                                <span class="glyphicon glyphicon-search"></span>查看
                                                            </button>

                                                            <button class="btn btn-xs" ng-show="todo.todoPhase == 0"
                                                                    style="margin-right: 5px; background-color: #2e6da4; color: white;"
                                                                    ng-click="editTodo(todo)">
                                                                <span class="glyphicon glyphicon-edit"></span>编辑
                                                            </button>

                                                            <button class="btn btn-xs" ng-show="todo.todoPhase != 5"
                                                                    style="margin-right: 5px; background-color: #ff8700; color: white;"
                                                                    ng-click="revokeTodo(todo.id)"
                                                                    uib-popover-html="'删除工作流申请'"
                                                                    popover-trigger="'mouseenter'">
                                                                <i class="fa fa-spin fa-spinner" ng-show="btnTodoClick"></i>
                                                                <span class="glyphicon glyphicon-remove"></span>撤销
                                                            </button>

                                                            <button class="btn btn-xs" ng-show="todo.todoStatus == 0 && todo.todoDetails !=0 && todo.todoPhase == 0"
                                                                    style="margin-right: 25px; background-color: #2e6da4; color: white;"
                                                                    ng-click="applyTodo(todo)">
                                                                <i class="fa fa-spin fa-spinner" ng-show="btnTodoClick"></i>
                                                                <span class="icon icon-paper-plane"></span>申请
                                                            </button>

                                                            <button class="btn btn-xs" ng-show="todo.isApproval"
                                                                    style="margin-right: 5px; background-color: #20a03f; color: white;"
                                                                    ng-click="approvalTodo(todo.id)"
                                                                    uib-popover-html="'TL&DL审批工作流'"
                                                                    popover-trigger="'mouseenter'">
                                                                <i class="fa fa-spin fa-spinner" ng-show="btnTodoClick"></i>
                                                                <span class="glyphicon glyphicon-ok"></span>审批
                                                            </button>

                                                            <button class="btn btn-xs" ng-show="todo.isApproval"
                                                                    style="margin-right: 5px; background-color: #ef2929; color: white;"
                                                                    ng-click="disapproveTodo(todo.id)"
                                                                    uib-popover-html="'TL&DL审批工作流(不批准)'"
                                                                    popover-trigger="'mouseenter'">
                                                                <i class="fa fa-spin fa-spinner" ng-show="btnTodoClick"></i>
                                                                <span class="glyphicon glyphicon-remove"></span>不批准
                                                            </button>

                                                            <button class="btn btn-xs" ng-show="todo.isAudit"
                                                                    style="margin-right: 5px; background-color: #ef2929; color: white;"
                                                                    ng-click="approvalTodo(todo.id)"
                                                                    uib-popover-html="'OPS审核工作流'"
                                                                    popover-trigger="'mouseenter'">
                                                                <span class="glyphicon glyphicon-ok"></span>审核
                                                            </button>

                                                            <button class="btn btn-xs" ng-show="todo.isAudit"
                                                                    style="margin-right: 5px; background-color: #ef2929; color: white;"
                                                                    ng-click="disapproveTodo(todo.id)"
                                                                    uib-popover-html="'OPS审核工作流(不批准)'"
                                                                    popover-trigger="'mouseenter'">
                                                                <i class="fa fa-spin fa-spinner" ng-show="btnTodoClick"></i>
                                                                <span class="glyphicon glyphicon-remove"></span>不批准
                                                            </button>


                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </uib-accordion>
                                <!--完成工单-->
                                <uib-accordion>
                                    <div class="panel panel-default">
                                        <div uib-accordion-group class="panel-info" is-open="status.open">
                                            <uib-accordion-heading>完成工作流
                                                <i class="pull-right glyphicon"
                                                   ng-class="{'glyphicon-chevron-down': status.open, 'glyphicon-chevron-right': !status.open}"></i>
                                            </uib-accordion-heading>
                                            <div style="margin-top: 5px;">
                                                <table class="table table-striped">
                                                    <thead>
                                                    <tr>
                                                        <td class="col-md-1">类别</td>
                                                        <td class="col-md-5">详情</td>
                                                        <td>状态</td>
                                                        <td>历时</td>
                                                        <td>操作</td>
                                                    </tr>
                                                    </thead>
                                                    <tbody>

                                                    <tr ng-repeat="todo in myCompleteTodoList">
                                                        <td>
                                                            <b style="color: #286090"
                                                               ng-show="todo.workflowDO.wfType == 0">OPS</b>
                                                            <b style="color: #286090"
                                                               ng-show="todo.workflowDO.wfType == 1">OTHER</b>
                                                        </td>
                                                        <td>
                                                            <b style="color: #286090">{{todo.workflowDO.title}}</b>
                                                            <i uib-popover-html="todoDetail.initiatorUserDO.initiatorUserInfo"
                                                               popover-trigger="'mouseenter'"
                                                               class="icon icon-info pull-right"
                                                               style="color: green;"></i>
                                                            <b style="color: #286090" class="pull-right">{{todo.applyDisplayName}}</b>

                                                        </td>
                                                        <td>
                                                            <b style="color: #20a03f;"
                                                               ng-show="todo.todoStatus == 3">正常结束</b>
                                                            <b style="color: #ef2929;"
                                                               ng-show="todo.todoStatus == 2">拒绝</b>
                                                        </td>
                                                        <td>
                                                            <b>{{todo.applyViewTime}}</b>
                                                        </td>
                                                        <td>
                                                            <button class="btn btn-xs"
                                                                    style="margin-right: 5px; background-color: green; color: white;"
                                                                    ng-click="viewTodo(todo)">
                                                                <span class="glyphicon glyphicon-search"></span>查看
                                                            </button>

                                                            <button class="btn btn-xs" ng-show="todo.todoPhase == 0"
                                                                    style="margin-right: 5px; background-color: #2e6da4; color: white;"
                                                                    ng-click="editTodo(todo)">
                                                                <span class="glyphicon glyphicon-edit"></span>编辑
                                                            </button>

                                                            <button class="btn btn-xs" ng-show="todo.todoPhase != 5"
                                                                    style="margin-right: 5px; background-color: #2e6da4; color: white;"
                                                                    ng-click="revokeTodo(todo.id)"
                                                                    uib-popover-html="'删除工作流申请'"
                                                                    popover-trigger="'mouseenter'">
                                                                <span class="glyphicon glyphicon-remove"></span>撤销
                                                            </button>

                                                            <button class="btn btn-xs" ng-show="todo.isApproval"
                                                                    style="margin-right: 5px; background-color: #20a03f; color: white;"
                                                                    ng-click="approvalTodo(todo.id)"
                                                                    uib-popover-html="'TL&DL审批工作流'"
                                                                    popover-trigger="'mouseenter'">
                                                                <span class="glyphicon glyphicon-ok"></span>审批
                                                            </button>

                                                            <button class="btn btn-xs" ng-show="todo.isAudit"
                                                                    style="margin-right: 5px; background-color: #ef2929; color: white;"
                                                                    ng-click="approvalTodo(todo.id)"
                                                                    uib-popover-html="'OPS审核工作流'"
                                                                    popover-trigger="'mouseenter'">
                                                                <span class="glyphicon glyphicon-ok"></span>审核
                                                            </button>

                                                            <!--<span class="glyphicon glyphicon-ok"-->
                                                            <!--ng-if="contains(authPoint, '/workflow/todo/invoke')"-->
                                                            <!--style="color: green; margin-left: 20px;"-->
                                                            <!--uib-popover-html="'执行工单'"-->
                                                            <!--popover-trigger="'mouseenter'"-->
                                                            <!--ng-click="invokeTodo(todo.id)">-->
                                                            <!--</span>-->
                                                        </td>
                                                    </tr>

                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </uib-accordion>
                            </form>
                        </div>
                    </div>
                </uib-tab>
                <uib-tab index="1" heading="工单详情">

                </uib-tab>
            </uib-tabset>

        </div>
    </div>
    <!-- / main -->
</div>



<script type="text/ng-template" id="todoKeyboxModal">
    <div ng-include="'tpl/modal/workflow/todo_keybox_modal.html'"></div>
</script>


<script type="text/ng-template" id="todoAliyunRamModal">
    <div ng-include="'tpl/modal/workflow/todo_aliyun_ram_modal.html'"></div>
</script>

<script type="text/ng-template" id="todoAliyunRamPolicyModal">
    <div ng-include="'tpl/modal/workflow/todo_aliyun_ram_policy_modal.html'"></div>
</script>

<!--LdapGroup-->
<script type="text/ng-template" id="todoLdapGroupModal">
    <div ng-include="'tpl/modal/workflow/todo_ldapGroup_modal.html'"></div>
</script>